|
|
|
|
|
|
|
|
You can use several different types of recordsets. A dynaset (dynamic recordset) is a set of records that changes dynamically as the data in the underlying database is modified. A snapshot represents a "picture" of a set of records at the time the recordset is created; subsequent changes to the underlying data are not reflected in the recordset.  |
|
|
|
|
|
|
|
|
|
|
In addition to making data available to your program, the Data control also provides record navigation functions. With the buttons indicated in Figure 25.1, users can move to the first or last record in the recordset, or to a record prior to or following the current record. The design of the buttons makes their use intuitive; they are similar to the buttons you would find on a VCR or a CD player. |
|
|
|
|
|
|
|
|
Figure 25.1
The VCR-like buttons on the Data
control provide navigation capabilities. |
|
|
|
|
|
|
|
|
The recordset created by the Data control is determined by the settings of the DatabaseName and RecordSource properties. If you set these two properties at designtime, then the recordset is created as the form containing the Data control loads. This recordset is normally active until the form is unloaded, at which time the recordset is released. |
|
|
|
|
|
|
|
|
|
A recordset by itself is not data; it is an object that represents (or points to) the data in a physical database. Even after a recordset is released or closed, the data in the underlying table(s) remains in the database.  |
|
|
|
|
|
|
|
|
|
|
Adding a Data Control to Your Form |
|
|
|
|
|
|
|
|
The first step in using a Data control is to add the control to your application's form. Select the Data control tool from the Toolbox. Next, place and size the Data control just as you do any other control. After you set the desired size and placement of the Data control on your form, you can set its Name and Caption properties. |
|
|
|
|
|
|
|
|
The Name property sets the control name, which you will be using later to identify the control to the data-bound controls. The default name for the first Data control added to a form is Data1. To change the name of a Data control, select its Name property from the Properties window and type the name you want. |
|
|
|
|
|
|
|
|
The Caption property specifies the text that appears on the Data control. You usually want the caption to be descriptive of the data the control accesses. The default for the Caption property is the initial setting of the Name property (for example, Data1 for the first Data control). You can change the Caption property the same way you change the Name property. |
|
|
|
|
|